import 'package:boss/models/takeout_order_list_data.dart';
import 'package:boss/textStyle/text_style.dart';
import 'package:boss/ui/page/takeoutManagement/constant/takeout_status.dart';
import 'package:boss/ui/widget/custom_divier.dart';
import 'package:flustars/flustars.dart' as flustars;
import 'package:flutter/material.dart';
import 'package:hi_common/hi_common.dart';

import 'message_row.dart';
import 'phone_icon.dart';

class DeliverMessage extends StatelessWidget {
  final TakeoutOrderItem data;

  const DeliverMessage({Key key, this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    if (data.type == TakeoutStatus.SELF_PICK || !RegUtil.testNotEqEmpty(data.deliveryName)) return SizedBox();

    return Column(
      children: <Widget>[
        CustomDivider(),
        MessageRow(
          children: <Widget>[
            Text(
              '配送员：${data.deliveryName}',
              style: TextStyleConstant().normal_1_28,
            ),
            Text(
              '${RegUtil.testNotEqEmpty(data.deliveryPhone) ? flustars.TextUtil.hideNumber(data.deliveryPhone) : '--'}',
              style: TextStyleConstant().normal_1_26,
            ),
            if (data.takeOutStatus == TakeoutStatus.ORDER_COMPUTED)
              Text(
                '订单于：${data.deliveryTime}送达客户处',
                style: TextStyleConstant().normal_1_26,
              ),
          ],
          suffix: PhoneIcon(data.deliveryPhone),
        ),
      ],
    );
  }
}
